package entity

import (
	"time"
)

type SysUser struct {
	Model
	UserName string `json:"userName" gorm:"column:username"`
	NickName string `json:"nikeName" gorm:"column:nickname"`
	Gender   uint8  `json:"gender" gorm:"column:gender"`
	Password string `json:"password"`
	DeptId   uint32 `json:"deptId" gorm:"column:dept_id"`
	Avatar   string `json:"avatar" gorm:"column:avatar"`
	Mobile   string `json:"mobile" gorm:"column:mobile"`
	Status   uint8  `json:"status"` //状态((1-正常 0-禁用)
	Email    string `json:"email" gorm:"column:email"`
}

func (SysUser) TableName() string {
	return "sys_user"
}

type UserOption struct {
	ID       uint64 `json:"id" gorm:"column:id"`
	UserName string `json:"username" gorm:"column:username"`
}

// 用户列表类
type UserPageVO struct {
	ID          uint64 `json:"id"`
	UserName    string `json:"username" `
	NickName    string `json:"nickname"`
	Mobile      string `json:"mobile" `
	GenderLabel string `json:"genderLabel"`
	Avatar      string `json:"avatar"`
	Email       string `json:"email"`
	Status      uint8  `json:"status"`
	DeptName    string `json:"deptName"`
	RoleNames   string `json:"roleNames"`
	CreateTime  string `json:"createTime"`
}

type UserBO struct {
	ID         uint64    `gorm:"primary_key" json:"id"`
	UserName   string    `json:"userName" gorm:"column:username"`
	NickName   string    `json:"nikeName" gorm:"column:nickname"`
	Mobile     string    `json:"mobile" gorm:"mobile"`
	Gender     uint8     `json:"gender" gorm:"gender"`
	Avatar     string    `json:"avatar" gorm:"avatar"`
	Email      string    `json:"email" gorm:"email"`
	Status     uint8     `json:"status" gorm:"status"`
	DeptName   string    `json:"deptName"  gorm:"dept_name"`
	RoleNames  string    `json:"roleNames"  gorm:"role_names"`
	CreateTime time.Time `json:"createTime" gorm:"column:create_time;type:datetime"`
}

type SysUserPageQuery struct {
	PageQuery PageQuery
	Status    *uint8     `form:"status"`
	DeptId    *uint64    `form:"deptId"`
	StartTime *time.Time `form:"startTime"`
	EndTime   *time.Time `form:"endTime"`
}

type UserForm struct {
	ID       uint64   `json:"id" gorm:"primary_key"`
	UserName string   `json:"username" gorm:"column:username"`
	NickName string   `json:"nickname" gorm:"column:nickname"`
	Mobile   string   `json:"mobile" gorm:"mobile"`
	Gender   uint8    `json:"gender" gorm:"column:gender"`
	Avatar   string   `json:"avatar" gorm:"avatar"`
	Email    string   `json:"email" gorm:"column:email"`
	Status   uint8    `json:"status" gorm:"status"`
	DeptId   uint32   `json:"deptId" gorm:"dept_id"`
	RoleIds  []uint64 `json:"roleIds"`
}
